package com.weatherinczbackend.exceptions;

/**
 * The base of Weather checked exceptions.
 *
 * @author Michal Stava <stavamichal@gmail.com>
 */
public abstract class ComplexException extends Exception {

    private String errorId = Long.toHexString(System.currentTimeMillis());

    public ComplexException() {
        super();  
    }
    
    public ComplexException(String message) {
        super(message);
    }

    public ComplexException(String message, Throwable cause) {
        super(message, cause);
    }

    public ComplexException(Throwable cause) {
        super(cause!=null?cause.getMessage():null,cause);
    }

    @Override
    public String getMessage() {
        return "Error "+errorId+": "+super.getMessage();
    }

    public String getErrorId() {
        return errorId;
    }
    
    public void setErrorId(String errorId) {
      this.errorId = errorId;
    }
}
